<?php include "antet.php"; include "func.php";

if (isset($_SESSION["user"][0], $_GET["town"]))
{
	$_GET["town"]=clean($_GET["town"]);
	$town=town($_GET["town"]); if ($town[1]!=$_SESSION["user"][0]) {header('Location: login.php'); die();}
}
else {header('Location: login.php'); die();}

	$res=explode("-", $town[10]);
	$prod=explode("-", $town[9]); 
	$lim=explode("-", $town[11]); 
	$out=explode("-", $buildings[8][5]); 
	$weaps = explode ( "-", $town [6] );
	$army=explode("-", $town[7]);
kepala($title." - ".$lang['townEdit']);
?>
<script type="text/javascript">
var res_start0=<?php echo floor($res[0]);?>;var res_start1=<?php echo floor($res[1]);?>;var res_start2=<?php echo floor($res[2]);?>;var res_start3=<?php echo floor($res[3]);?>;var res_start4=<?php echo floor($res[4]);?>;
var res_limit0=<?php echo $lim[0];?>;var res_limit1=<?php echo $lim[1];?>;var res_limit2=<?php echo $lim[1];?>;var res_limit3=<?php echo $lim[1];?>;var res_limit4=<?php echo $lim[2];?>;
var res_ph0=<?php echo ($prod[0]-$town[3]-$town[12]);?>;var res_ph1=<?php echo ($prod[1]);?>;var res_ph2=<?php echo ($prod[2]);?>;var res_ph3=<?php echo ($prod[3]);?>;var res_ph4=<?php echo ($prod[4]);?>;
var res_sec0=0;var res_sec1=0;var res_sec2=0;var res_sec3=0;var res_sec4=0;
</script>
<?php
$output = "";
		$lim=explode("-", $town[11]);
		$output .= BlankHeader($town, $lim, $lang['townEdit'] , "Change town name","");
		$output .= showproduction($town,$lim); 
		$output .= '
<form class="form" role="form" name="form1" method="post" action="town_edit_.php?town='.$_GET["town"].'">
	<div class="form-group">
		<label for="name">'.$lang['townName'].'</label>:
		<input class="form-control textbox" type="text" name="name" value="'.$town[2].'">
	</div>
	<div class="form-group">
		<label for="'.$lang['description'].'">'.$lang['description'].'</label>:
		<textarea class="form-control textbox" name="desc" cols="45" rows="5">'.$town[14].'</textarea></p>
		<input class="btn btn-block btn-success" type="submit" name="button" value="'.$lang['save'].'">
	</div>
</form>';
		$output .= ads(1,"bottom");
		$output .= about(); 
		echo $output;
?>
